<?php $this->load->view('header'); ?>
<div id="search-project">
	<?php echo $this->load->view('sideBlocks/searchBlock') ?>
</div>
<div class="wrap-content wrap-project">
    <div class="container">
        <div class="row">
            <div class="list-search-project">
                <div class="col-lg-12 col-xs-12 no-padding content-list-search-project">
					<ul class="project-categories">
	                    <?php
	                        if(count($groupCategories) > 0){
								$id_current = $this->uri->segment(3, '0');
	                            foreach($groupCategories as $item){
	                    ?>
	                    <li class="col-lg-3">
	                        <a class="x8-16-b "><?php echo $item['group_name'];?></a>
	                    <?php
                            if(!empty($item['categories'])){
	                    ?>
	                        <ul>
	                    <?php
	                        foreach($item['categories']->result() as $item_categories){
								$classA = "";
								if($id_current == $item_categories->id){
									$classA = "class='active'";
								}
	                    ?>
	                            <li><a <?php echo $classA;?> href="<?php echo site_url('project/category/'.$item_categories->id)?>" class=""><?php echo $item_categories->name;?></a></li>
	                    <?php
	                            }
	                    ?>
	                        </ul>
	                    <?php } ?>
	                    </li>
	                    <?php } }?>
                    </ul>
                </div>
            </div> <!-- list-search-project -->
            <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 text-center">
                <?php echo $this->lang->line("The project with your skills")?>
            </div>
            <div class="freelancer-pagination text-center col-lg-12 col-md-12 col-sm-12">
                      <?php
                      	if(isset($pagination)) 
                      		echo $pagination;
                      ?>
                </div> <!-- freelancer pagination -->
        </div>
    </div>
</div>

    <div class="wrap-content wrap-public-message">
    </div>
    <div class="wrap-content wrap-project">
        <div class="container">
            <div class="">
                <div class="list-project col-lg-12">
                    <div class="table-projects row">
                        <table class="col-lg-12 table col-md-12 col-sm-12 col-xs-12 no-padding">
                            <thead>
                            <tr class="x8-16-b">
                                <td class="col-lg-4"><?php echo $this->lang->line("Project Name")?></td>
                                <td class="col-lg-2"><?php echo $this->lang->line("Num bid")?></td>
                                <td class="col-lg-2"><?php echo $this->lang->line("Skills")?></td>
                                <td class="col-lg-2"><?php echo $this->lang->line("Created")?></td>
                                <td class="col-lg-2"><?php echo $this->lang->line("budget")?></td>
                            </tr>
                            </thead>
                            <tbody>
                        <?php
                            if (isset($projects) and $projects->num_rows() > 0) {
                                foreach ($projects->result() as $project) {
                                    ?>
                                    <tr class="x8-15">
                                        <td class="xanh-16-b"><a href="<?php echo site_url('project/view/'.$project->id)?>"><?php echo $project->project_name; ?></a>
                                            <div class="rating-freelancer col-lg-12 no-padding">
                                                <input id="input-21e" value="0" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5 step=0.5 data-size="xs" >
                                            </div> <!-- rating-freelancer -->
                                        </td>
                                        <td><?php echo getNumBid($project->id)?></td>
                                        <td class="green-16"><?php echo getCategoryLinks($project->project_categories); ?></td>
                                        <td><?php
                                            if(date("d/m/y") == date("d/m/y",$project->created))
                                                echo "Hôm nay";
                                            else
                                                echo date("d/m/y", $project->created);?></td>
                                        <td class="green-20-b" style="font-size: 17px;">Từ $<?php echo $project->budget_min?> - $<?php echo $project->budget_max?></td>
                                    </tr>
                                    <tr>
                                        <td class="col-lg-9 col-sm-6 col-md-6 desc-list-project" colspan="3"><?php echo $project->description; ?></td>
                                        <td colspan="2" class="col-lg-3 col-sm-6 col-md-6">
                                            <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12">
                                                <?php if(isBuyer()) {?>
                                                    <button type="button" onclick="window.location = '<?php echo site_url('project/create')?>'" class="btn btn-similar-project btn-lg btn-block">Đăng một dự án giống vậy</button>
                                                <?php } elseif(isProgrammer()) { ?>
                                                    <button type="button" onclick="window.location = '<?php echo site_url('project/view/'.$project->id)?>'" class="btn btn-similar-project btn-lg btn-block">Bid</button>
                                                <?php } ?>
                                            </div>
                                        </td>
                                    </tr>

                                <?php
                                }
                            }else{
                                echo "<tr>
                                    <td>".$this->lang->line('No Results')."</td>
                                </tr>";
                            }
                            ?>
                            </tbody>
                        </table>
                    </div> <!-- table-list-project -->
                    <div class="freelancer-pagination text-center col-lg-12 col-md-12 col-sm-12">
                        <?php if(isset($pagination)) echo $pagination;?>
                    </div> <!-- freelancer pagination -->
                </div> <!-- list-project -->
            </div> <!-- end row content -->
        </div>
    </div> <!-- wrap-content -->







<?php $this->load->view('footer'); ?>